public class Solution1 {
    public SingleList.ListNode getIntersectionNode(SingleList.ListNode headA, SingleList.ListNode headB) {
        SingleList.ListNode pLong = headA; // 假设A长
        SingleList.ListNode pShort = headB;
        int len1 = 0;
        int len2 = 0;
        // 1.求两个链表长度
        while(pLong != null) {
            len1++;
            pLong = pLong.next;
        }
        while(pShort != null) {
            len2++;
            pShort = pShort.next;
        }
        pLong = headA;
        pShort = headB;
        // 2.求差值
        int len = len1 - len2;
        if(len < 0) {
            pLong = headB;
            pShort = headA;
            len = len2 - len1;
        }
        // 3.长的链表 先走差值的步
        while (len != 0) {
            pLong = pLong.next;
            len--;
        }
        // 4.同时走
        while (pLong != pShort) {
            pLong = pLong.next;
            pShort = pShort.next;
        }
        return pLong;
    }
}